﻿using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.Security;

namespace ELoje_web.Account
{
    public partial class Login : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "Triade Modas";

        }

        protected void LogIn(object sender, EventArgs e)
        {
            //if (validaUsuario(txtUserName.Text, txtPassword.Text))
            //{
            //    FormsAuthentication.Initialize();
            //    string strPerfil = atribuirPerfil(txtUserName.Text);
            //    FormsAuthenticationTicket fat = new FormsAuthenticationTicket(1,
            //                                                                 txtUserName.Text, DateTime.Now,
            //                                                                 DateTime.Now.AddMinutes(30), false, "strPerfil",
            //                                                                 FormsAuthentication.FormsCookiePath);
            //    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)));
            //    Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text, false));
            //}
            //else
            //{
            //    FailureText.Text = "Falha na autentição";
            //    ErrorMessage.Visible = true;
            //}
        }

        private string atribuirPerfil(string p)
        {
            return "";
        }

        private bool validaUsuario(string strNomeUsuario, string strPassword)
        {
            //Retorna True se o nome e senha do usuário forem válidos
            return (1==1);
        }

    }
}